Video={
		queryInfoUrl:SKYLINE_DOMAIN+"video/queryInfo.html",
		addVideoUrl:SKYLINE_DOMAIN+"video/addVideo.html",
		queryInfo:function(){
			var url=$("#videoUrl").val();
			$("#videoUrl").attr("disabled",true);
			$("#videoQueryInfoMessage").text("正在解析您所输入的url...");
			$.ajax({
				url: Video.queryInfoUrl,
				data:"url="+url,
				type : "GET",
				dataType:"json",
				contentType: "application/x-www-form-urlencoded; charset=utf-8", 
				success : function(video){
					if(video==null){
						$("#videoUrl").attr("disabled",false);
						$("#videoQueryInfoMessage").text("您所输入的url无法解析。");
					}else{
						var text="<table><tr>";
						text+="<td rowspan='3'><img src='"+video.thumbnail+"'></td>";
						text+="<td>标题:</td><td colspan='3'><input type='text' id='videoTitle' value='"+video.title+"' size='48'/></td></tr>";
						text+="<td>简介:</td><td colspan='3'><textarea id='videoSummary' cols='32' rows='2'>"+video.summary+"</textarea></td></tr>";
						text+="<td>来源:</td><td>"+video.source+"</td><td>片长:</td><td>"+video.time+"</td></tr>";
						text+="<td colspan='5'><input type='button'  value='提交' onclick='javascript:Video.addVideo();'/></td></tr></table>";
						$("#videoDiv").html(text);
					}
				},
				error:function(){
					$("#videoUrl").attr("disabled",false);
					$("#videoQueryInfoMessage").text("您所输入的url无法解析。");
				}
			});
		},
		addVideo:function(){
			var title=$("#videoTitle").val();
			var summary=$("#videoSummary").val();
			$.ajax({
				url: Video.addVideoUrl,
				data:"title="+title+"&summary="+summary,
				type : "POST",
				dataType:"json",
				contentType: "application/x-www-form-urlencoded; charset=utf-8", 
				success : function(id){
					if(id==0){
						//$("#videoUrl").attr("disabled",false);
						//$("#videoQueryInfoMessage").text("您所输入的url无法解析。");
					}else{
						var text="	<table><tr><td id=\"videoQueryInfoMessage\">";
						text+="您已经成功分享了视频,点击<a href='"+SKYLINE_DOMAIN+"video/view/"+id+".html'>此处</a>浏览。";
						text+="</td></tr><tr><td width=\"460px\"><input id=\"videoUrl\" size=\"64\"></td><td><input type=\"button\" onclick=\"javascript:Video.queryInfo();\" value=\"提交\"></td></tr></table>";
						$("#videoDiv").html(text);
					}
				},
				error:function(){
				//	$("#videoUrl").attr("disabled",false);
					//$("#videoQueryInfoMessage").text("您所输入的url无法解析。");
				}
			});
		},
		getVideo:function(divId,flashUrl){
			var htmlCode="<embed src='"+flashUrl+"' allowFullScreen='true' quality='high' width='480' height='400' align='middle' allowScriptAccess='never' type='application/x-shockwave-flash' flashvars='isAutoPlay=true'></embed>";
			$("#"+divId).html(htmlCode);
		}
}